/**
 * 3
 *
 * @Author : roryrywang
 * @DateTime : 24-9-7 下午7:59
 */

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

void del(int a[], int k, int x) {
    int i = 0;
    while (a[i] != x) {
        i++;
    }
    int j = i;
    i++;
    while (i < k) {
        a[j++] = a[i++];
    }
}

void add(int a[], int k, int x) {
    if (x >= a[k - 2]) {
        a[k - 1] = x;
        return;
    }
    int j = k - 1;
    int i = j - 1;
    while (a[i] > x) {
        a[j--] = a[i--];
    }
    a[j] = x;
}

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }

    int sortList[k];
    for (int i = 0; i < k; ++i) {
        sortList[i] = a[i];
    }

    sort(sortList, sortList + k);
    if (k % 2) {
        cout << sortList[(k - 1) / 2] << " ";
    } else {
        cout << (sortList[(k - 1) / 2] + sortList[k / 2]) / 2.0 << " ";
    }
    for (int i = 1, j = i + k - 1; j < n; ++i, ++j) {
        int x = a[i - 1];
        del(sortList, k, x);
        x = a[j];
        add(sortList, k, x);

        if (k % 2) {
            cout << sortList[(k - 1) / 2] << " ";
        } else {
            cout << (sortList[(k - 1) / 2] + sortList[k / 2]) / 2.0 << " ";
        }
    }
    return 0;
}